import { request } from '@/utils/request.util';
import type { Root, DeptListRoot } from '@/types/root';
import type { Pagination } from '@/types/pagination';
import type { Response, Res } from '@/types/common';
import type {
  RegisterRes,
  DoctorRes,
  RegStatResponse,
} from '@/types/registerList';
// /stock/supply/?mfrName=&pageNo=1&pageSize=10

//查询挂号列表
export const getRegisterList = (body: {
  patientName?: string;
  deptId?: any;
  visitDate?: string;
  regStatus?: string;
  pageNo: number;
  pageSize: number;
}) =>
  request.get<RegisterRes>('/clinic/register/getRegisterList', {
    params: body,
  });

//获取医生当日挂号统计
export const getDoctorList = (visitDate: string) =>
  request.get<DoctorRes>('/clinic/register/getDoctorList', {
    params: { visitDate },
  });

export const getRemainList = (body: { visitDate?: string; doctorName?: any }) =>
  request.get<any>('/clinic/register/getRemainList', {
    params: body,
  });

// 退号
export const cancelRegister = (registerId: any) =>
  request.post<Response<Res>>('/clinic/register/cancelRegister', {
    registerId,
  });

//新增挂号 预约挂号
export const addRegister = (body: {
  patientName: string;
  patientSex: string;
  doctorName: string;
  patientPhone: string;
  idCard: string;
  ageYear: number;
  ageMonth: number;
  lunarBirthday: string;
  solarBirthday: string;
  visitDate: string;
  visitPeriod: string;
  regMethod: string;
  regChannel: string;
  doctorId: string;
  visitType: string;
  regType: string;
  regFee: number;
  remark: string;
}) => request.post<any>('/clinic/register/addRegister', body);

//预约取号
export const pickupRegister = (registerId: any) =>
  request.post<Response<any>>('/clinic/register/pickupRegister', {
    registerId,
  });

//挂号：根据日期统计诊所挂号情况
export const getRegisterStat = (
  patientName: any,
  deptId: any,
  doctorId: any,
  visitDate: any
) =>
  request.get<any>('/clinic/register/getRegisterStat', {
    params: { patientName, deptId, doctorId, visitDate },
  });
